import paramiko

def ftp_uplad_file(localpath, remotepath):
    try:
        tran = paramiko.Transport(('192.168.32.128',22))
        tran.connect(username='root',password='123456')

        client = paramiko.SFTPClient.from_transport(tran)
        client.put(localpath, remotepath)
        client.close()
        tran.close()
    except Exception as e:
        print(e)


def ftp_download_file(remotepath, localpath):
    try:
        tran = paramiko.Transport(('192.168.32.128',22))
        tran.connect(username='root', password='123456')
        client = paramiko.SFTPClient.from_transport(tran)
        client.get(remotepath, localpath)
        client.close()
        tran.close()
    except Exception as e:
        print(e)

if __name__ == '__main__':
    #ftp_uplad_file('D://fsboss.sql', '/root/a.sql')
    ftp_download_file('/root/a.txt', 'D://bbb.txt')